<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>cgbtrf.f</title>
 <meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!-- 
body { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default   { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default a { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.string   { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.string a { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.comment   { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.comment a { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
 --></style>

 </head>
  <body>

<pre>
      SUBROUTINE <a name="CGBTRF.1"></a><a href="cgbtrf.f.html#CGBTRF.1">CGBTRF</a>( M, N, KL, KU, AB, LDAB, IPIV, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- LAPACK routine (version 3.1) --
</span><span class="comment">*</span><span class="comment">     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment">     November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Scalar Arguments ..
</span>      INTEGER            INFO, KL, KU, LDAB, M, N
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      INTEGER            IPIV( * )
      COMPLEX            AB( LDAB, * )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Purpose
</span><span class="comment">*</span><span class="comment">  =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  <a name="CGBTRF.18"></a><a href="cgbtrf.f.html#CGBTRF.1">CGBTRF</a> computes an LU factorization of a complex m-by-n band matrix A
</span><span class="comment">*</span><span class="comment">  using partial pivoting with row interchanges.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  This is the blocked version of the algorithm, calling Level 3 BLAS.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Arguments
</span><span class="comment">*</span><span class="comment">  =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  M       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of rows of the matrix A.  M &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of columns of the matrix A.  N &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  KL      (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of subdiagonals within the band of A.  KL &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  KU      (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of superdiagonals within the band of A.  KU &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  AB      (input/output) COMPLEX array, dimension (LDAB,N)
</span><span class="comment">*</span><span class="comment">          On entry, the matrix A in band storage, in rows KL+1 to
</span><span class="comment">*</span><span class="comment">          2*KL+KU+1; rows 1 to KL of the array need not be set.
</span><span class="comment">*</span><span class="comment">          The j-th column of A is stored in the j-th column of the
</span><span class="comment">*</span><span class="comment">          array AB as follows:
</span><span class="comment">*</span><span class="comment">          AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)&lt;=i&lt;=min(m,j+kl)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">          On exit, details of the factorization: U is stored as an
</span><span class="comment">*</span><span class="comment">          upper triangular band matrix with KL+KU superdiagonals in
</span><span class="comment">*</span><span class="comment">          rows 1 to KL+KU+1, and the multipliers used during the
</span><span class="comment">*</span><span class="comment">          factorization are stored in rows KL+KU+2 to 2*KL+KU+1.
</span><span class="comment">*</span><span class="comment">          See below for further details.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDAB    (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array AB.  LDAB &gt;= 2*KL+KU+1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  IPIV    (output) INTEGER array, dimension (min(M,N))
</span><span class="comment">*</span><span class="comment">          The pivot indices; for 1 &lt;= i &lt;= min(M,N), row i of the
</span><span class="comment">*</span><span class="comment">          matrix was interchanged with row IPIV(i).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INFO    (output) INTEGER
</span><span class="comment">*</span><span class="comment">          = 0: successful exit
</span><span class="comment">*</span><span class="comment">          &lt; 0: if INFO = -i, the i-th argument had an illegal value
</span><span class="comment">*</span><span class="comment">          &gt; 0: if INFO = +i, U(i,i) is exactly zero. The factorization
</span><span class="comment">*</span><span class="comment">               has been completed, but the factor U is exactly
</span><span class="comment">*</span><span class="comment">               singular, and division by zero will occur if it is used
</span><span class="comment">*</span><span class="comment">               to solve a system of equations.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Further Details
</span><span class="comment">*</span><span class="comment">  ===============
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  The band storage scheme is illustrated by the following example, when
</span><span class="comment">*</span><span class="comment">  M = N = 6, KL = 2, KU = 1:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  On entry:                       On exit:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">      *    *    *    +    +    +       *    *    *   u14  u25  u36
</span><span class="comment">*</span><span class="comment">      *    *    +    +    +    +       *    *   u13  u24  u35  u46
</span><span class="comment">*</span><span class="comment">      *   a12  a23  a34  a45  a56      *   u12  u23  u34  u45  u56
</span><span class="comment">*</span><span class="comment">     a11  a22  a33  a44  a55  a66     u11  u22  u33  u44  u55  u66
</span><span class="comment">*</span><span class="comment">     a21  a32  a43  a54  a65   *      m21  m32  m43  m54  m65   *
</span><span class="comment">*</span><span class="comment">     a31  a42  a53  a64   *    *      m31  m42  m53  m64   *    *
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Array elements marked * are not used by the routine; elements marked
</span><span class="comment">*</span><span class="comment">  + need not be set on entry, but are required by the routine to store
</span><span class="comment">*</span><span class="comment">  elements of U because of fill-in resulting from the row interchanges.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Parameters ..
</span>      COMPLEX            ONE, ZERO
      PARAMETER          ( ONE = ( 1.0E+0, 0.0E+0 ),
     $                   ZERO = ( 0.0E+0, 0.0E+0 ) )
      INTEGER            NBMAX, LDWORK
      PARAMETER          ( NBMAX = 64, LDWORK = NBMAX+1 )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      INTEGER            I, I2, I3, II, IP, J, J2, J3, JB, JJ, JM, JP,
     $                   JU, K2, KM, KV, NB, NW
      COMPLEX            TEMP
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Arrays ..
</span>      COMPLEX            WORK13( LDWORK, NBMAX ),
     $                   WORK31( LDWORK, NBMAX )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      INTEGER            ICAMAX, <a name="ILAENV.104"></a><a href="ilaenv.f.html#ILAENV.1">ILAENV</a>
      EXTERNAL           ICAMAX, <a name="ILAENV.105"></a><a href="ilaenv.f.html#ILAENV.1">ILAENV</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           CCOPY, <a name="CGBTF2.108"></a><a href="cgbtf2.f.html#CGBTF2.1">CGBTF2</a>, CGEMM, CGERU, <a name="CLASWP.108"></a><a href="claswp.f.html#CLASWP.1">CLASWP</a>, CSCAL,
     $                   CSWAP, CTRSM, <a name="XERBLA.109"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          MAX, MIN
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     KV is the number of superdiagonals in the factor U, allowing for
</span><span class="comment">*</span><span class="comment">     fill-in
</span><span class="comment">*</span><span class="comment">
</span>      KV = KU + KL
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
      IF( M.LT.0 ) THEN
         INFO = -1
      ELSE IF( N.LT.0 ) THEN
         INFO = -2
      ELSE IF( KL.LT.0 ) THEN
         INFO = -3
      ELSE IF( KU.LT.0 ) THEN
         INFO = -4
      ELSE IF( LDAB.LT.KL+KV+1 ) THEN
         INFO = -6
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.136"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CGBTRF.136"></a><a href="cgbtrf.f.html#CGBTRF.1">CGBTRF</a>'</span>, -INFO )
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span>      IF( M.EQ.0 .OR. N.EQ.0 )
     $   RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Determine the block size for this environment
</span><span class="comment">*</span><span class="comment">
</span>      NB = <a name="ILAENV.147"></a><a href="ilaenv.f.html#ILAENV.1">ILAENV</a>( 1, <span class="string">'<a name="CGBTRF.147"></a><a href="cgbtrf.f.html#CGBTRF.1">CGBTRF</a>'</span>, <span class="string">' '</span>, M, N, KL, KU )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     The block size must not exceed the limit set by the size of the
</span><span class="comment">*</span><span class="comment">     local arrays WORK13 and WORK31.
</span><span class="comment">*</span><span class="comment">
</span>      NB = MIN( NB, NBMAX )
<span class="comment">*</span><span class="comment">
</span>      IF( NB.LE.1 .OR. NB.GT.KL ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Use unblocked code
</span><span class="comment">*</span><span class="comment">
</span>         CALL <a name="CGBTF2.158"></a><a href="cgbtf2.f.html#CGBTF2.1">CGBTF2</a>( M, N, KL, KU, AB, LDAB, IPIV, INFO )
      ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Use blocked code
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Zero the superdiagonal elements of the work array WORK13
</span><span class="comment">*</span><span class="comment">
</span>         DO 20 J = 1, NB
            DO 10 I = 1, J - 1
               WORK13( I, J ) = ZERO
   10       CONTINUE
   20    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Zero the subdiagonal elements of the work array WORK31
</span><span class="comment">*</span><span class="comment">
</span>         DO 40 J = 1, NB
            DO 30 I = J + 1, NB
               WORK31( I, J ) = ZERO
   30       CONTINUE
   40    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Gaussian elimination with partial pivoting
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Set fill-in elements in columns KU+2 to KV to zero
</span><span class="comment">*</span><span class="comment">
</span>         DO 60 J = KU + 2, MIN( KV, N )
            DO 50 I = KV - J + 2, KL
               AB( I, J ) = ZERO
   50       CONTINUE
   60    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        JU is the index of the last column affected by the current
</span><span class="comment">*</span><span class="comment">        stage of the factorization
</span><span class="comment">*</span><span class="comment">
</span>         JU = 1
<span class="comment">*</span><span class="comment">
</span>         DO 180 J = 1, MIN( M, N ), NB
            JB = MIN( NB, MIN( M, N )-J+1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           The active part of the matrix is partitioned
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              A11   A12   A13
</span><span class="comment">*</span><span class="comment">              A21   A22   A23
</span><span class="comment">*</span><span class="comment">              A31   A32   A33
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Here A11, A21 and A31 denote the current block of JB columns
</span><span class="comment">*</span><span class="comment">           which is about to be factorized. The number of rows in the
</span><span class="comment">*</span><span class="comment">           partitioning are JB, I2, I3 respectively, and the numbers
</span><span class="comment">*</span><span class="comment">           of columns are JB, J2, J3. The superdiagonal elements of A13
</span><span class="comment">*</span><span class="comment">           and the subdiagonal elements of A31 lie outside the band.
</span><span class="comment">*</span><span class="comment">
</span>            I2 = MIN( KL-JB, M-J-JB+1 )
            I3 = MIN( JB, M-J-KL+1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           J2 and J3 are computed after JU has been updated.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Factorize the current block of JB columns
</span><span class="comment">*</span><span class="comment">
</span>            DO 80 JJ = J, J + JB - 1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Set fill-in elements in column JJ+KV to zero
</span><span class="comment">*</span><span class="comment">
</span>               IF( JJ+KV.LE.N ) THEN
                  DO 70 I = 1, KL
                     AB( I, JJ+KV ) = ZERO
   70             CONTINUE
               END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Find pivot and test for singularity. KM is the number of
</span><span class="comment">*</span><span class="comment">              subdiagonal elements in the current column.
</span><span class="comment">*</span><span class="comment">
</span>               KM = MIN( KL, M-JJ )
               JP = ICAMAX( KM+1, AB( KV+1, JJ ), 1 )
               IPIV( JJ ) = JP + JJ - J
               IF( AB( KV+JP, JJ ).NE.ZERO ) THEN
                  JU = MAX( JU, MIN( JJ+KU+JP-1, N ) )
                  IF( JP.NE.1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                    Apply interchange to columns J to J+JB-1
</span><span class="comment">*</span><span class="comment">
</span>                     IF( JP+JJ-1.LT.J+KL ) THEN
<span class="comment">*</span><span class="comment">
</span>                        CALL CSWAP( JB, AB( KV+1+JJ-J, J ), LDAB-1,
     $                              AB( KV+JP+JJ-J, J ), LDAB-1 )
                     ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                       The interchange affects columns J to JJ-1 of A31
</span><span class="comment">*</span><span class="comment">                       which are stored in the work array WORK31
</span><span class="comment">*</span><span class="comment">
</span>                        CALL CSWAP( JJ-J, AB( KV+1+JJ-J, J ), LDAB-1,
     $                              WORK31( JP+JJ-J-KL, 1 ), LDWORK )
                        CALL CSWAP( J+JB-JJ, AB( KV+1, JJ ), LDAB-1,
     $                              AB( KV+JP, JJ ), LDAB-1 )
                     END IF
                  END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Compute multipliers
</span><span class="comment">*</span><span class="comment">
</span>                  CALL CSCAL( KM, ONE / AB( KV+1, JJ ), AB( KV+2, JJ ),
     $                        1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Update trailing submatrix within the band and within
</span><span class="comment">*</span><span class="comment">                 the current block. JM is the index of the last column
</span><span class="comment">*</span><span class="comment">                 which needs to be updated.
</span><span class="comment">*</span><span class="comment">
</span>                  JM = MIN( JU, J+JB-1 )
                  IF( JM.GT.JJ )
     $               CALL CGERU( KM, JM-JJ, -ONE, AB( KV+2, JJ ), 1,
     $                           AB( KV, JJ+1 ), LDAB-1,
     $                           AB( KV+1, JJ+1 ), LDAB-1 )
               ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 If pivot is zero, set INFO to the index of the pivot
</span><span class="comment">*</span><span class="comment">                 unless a zero pivot has already been found.
</span><span class="comment">*</span><span class="comment">
</span>                  IF( INFO.EQ.0 )
     $               INFO = JJ
               END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Copy current column of A31 into the work array WORK31
</span><span class="comment">*</span><span class="comment">
</span>               NW = MIN( JJ-J+1, I3 )
               IF( NW.GT.0 )
     $            CALL CCOPY( NW, AB( KV+KL+1-JJ+J, JJ ), 1,
     $                        WORK31( 1, JJ-J+1 ), 1 )
   80       CONTINUE
            IF( J+JB.LE.N ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Apply the row interchanges to the other blocks.
</span><span class="comment">*</span><span class="comment">
</span>               J2 = MIN( JU-J+1, KV ) - JB
               J3 = MAX( 0, JU-J-KV+1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Use <a name="CLASWP.291"></a><a href="claswp.f.html#CLASWP.1">CLASWP</a> to apply the row interchanges to A12, A22, and
</span><span class="comment">*</span><span class="comment">              A32.
</span><span class="comment">*</span><span class="comment">
</span>               CALL <a name="CLASWP.294"></a><a href="claswp.f.html#CLASWP.1">CLASWP</a>( J2, AB( KV+1-JB, J+JB ), LDAB-1, 1, JB,
     $                      IPIV( J ), 1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Adjust the pivot indices.
</span><span class="comment">*</span><span class="comment">
</span>               DO 90 I = J, J + JB - 1
                  IPIV( I ) = IPIV( I ) + J - 1
   90          CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Apply the row interchanges to A13, A23, and A33
</span><span class="comment">*</span><span class="comment">              columnwise.
</span><span class="comment">*</span><span class="comment">
</span>               K2 = J - 1 + JB + J2
               DO 110 I = 1, J3
                  JJ = K2 + I
                  DO 100 II = J + I - 1, J + JB - 1
                     IP = IPIV( II )
                     IF( IP.NE.II ) THEN
                        TEMP = AB( KV+1+II-JJ, JJ )
                        AB( KV+1+II-JJ, JJ ) = AB( KV+1+IP-JJ, JJ )
                        AB( KV+1+IP-JJ, JJ ) = TEMP
                     END IF
  100             CONTINUE
  110          CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Update the relevant part of the trailing submatrix
</span><span class="comment">*</span><span class="comment">
</span>               IF( J2.GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Update A12
</span><span class="comment">*</span><span class="comment">
</span>                  CALL CTRSM( <span class="string">'Left'</span>, <span class="string">'Lower'</span>, <span class="string">'No transpose'</span>, <span class="string">'Unit'</span>,
     $                        JB, J2, ONE, AB( KV+1, J ), LDAB-1,
     $                        AB( KV+1-JB, J+JB ), LDAB-1 )
<span class="comment">*</span><span class="comment">
</span>                  IF( I2.GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                    Update A22
</span><span class="comment">*</span><span class="comment">
</span>                     CALL CGEMM( <span class="string">'No transpose'</span>, <span class="string">'No transpose'</span>, I2, J2,
     $                           JB, -ONE, AB( KV+1+JB, J ), LDAB-1,
     $                           AB( KV+1-JB, J+JB ), LDAB-1, ONE,
     $                           AB( KV+1, J+JB ), LDAB-1 )
                  END IF
<span class="comment">*</span><span class="comment">
</span>                  IF( I3.GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                    Update A32
</span><span class="comment">*</span><span class="comment">
</span>                     CALL CGEMM( <span class="string">'No transpose'</span>, <span class="string">'No transpose'</span>, I3, J2,
     $                           JB, -ONE, WORK31, LDWORK,
     $                           AB( KV+1-JB, J+JB ), LDAB-1, ONE,
     $                           AB( KV+KL+1-JB, J+JB ), LDAB-1 )
                  END IF
               END IF
<span class="comment">*</span><span class="comment">
</span>               IF( J3.GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Copy the lower triangle of A13 into the work array
</span><span class="comment">*</span><span class="comment">                 WORK13
</span><span class="comment">*</span><span class="comment">
</span>                  DO 130 JJ = 1, J3
                     DO 120 II = JJ, JB
                        WORK13( II, JJ ) = AB( II-JJ+1, JJ+J+KV-1 )
  120                CONTINUE
  130             CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Update A13 in the work array
</span><span class="comment">*</span><span class="comment">
</span>                  CALL CTRSM( <span class="string">'Left'</span>, <span class="string">'Lower'</span>, <span class="string">'No transpose'</span>, <span class="string">'Unit'</span>,
     $                        JB, J3, ONE, AB( KV+1, J ), LDAB-1,
     $                        WORK13, LDWORK )
<span class="comment">*</span><span class="comment">
</span>                  IF( I2.GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                    Update A23
</span><span class="comment">*</span><span class="comment">
</span>                     CALL CGEMM( <span class="string">'No transpose'</span>, <span class="string">'No transpose'</span>, I2, J3,
     $                           JB, -ONE, AB( KV+1+JB, J ), LDAB-1,
     $                           WORK13, LDWORK, ONE, AB( 1+JB, J+KV ),
     $                           LDAB-1 )
                  END IF
<span class="comment">*</span><span class="comment">
</span>                  IF( I3.GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                    Update A33
</span><span class="comment">*</span><span class="comment">
</span>                     CALL CGEMM( <span class="string">'No transpose'</span>, <span class="string">'No transpose'</span>, I3, J3,
     $                           JB, -ONE, WORK31, LDWORK, WORK13,
     $                           LDWORK, ONE, AB( 1+KL, J+KV ), LDAB-1 )
                  END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Copy the lower triangle of A13 back into place
</span><span class="comment">*</span><span class="comment">
</span>                  DO 150 JJ = 1, J3
                     DO 140 II = JJ, JB
                        AB( II-JJ+1, JJ+J+KV-1 ) = WORK13( II, JJ )
  140                CONTINUE
  150             CONTINUE
               END IF
            ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Adjust the pivot indices.
</span><span class="comment">*</span><span class="comment">
</span>               DO 160 I = J, J + JB - 1
                  IPIV( I ) = IPIV( I ) + J - 1
  160          CONTINUE
            END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Partially undo the interchanges in the current block to
</span><span class="comment">*</span><span class="comment">           restore the upper triangular form of A31 and copy the upper
</span><span class="comment">*</span><span class="comment">           triangle of A31 back into place
</span><span class="comment">*</span><span class="comment">
</span>            DO 170 JJ = J + JB - 1, J, -1
               JP = IPIV( JJ ) - JJ + 1
               IF( JP.NE.1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 Apply interchange to columns J to JJ-1
</span><span class="comment">*</span><span class="comment">
</span>                  IF( JP+JJ-1.LT.J+KL ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                    The interchange does not affect A31
</span><span class="comment">*</span><span class="comment">
</span>                     CALL CSWAP( JJ-J, AB( KV+1+JJ-J, J ), LDAB-1,
     $                           AB( KV+JP+JJ-J, J ), LDAB-1 )
                  ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                    The interchange does affect A31
</span><span class="comment">*</span><span class="comment">
</span>                     CALL CSWAP( JJ-J, AB( KV+1+JJ-J, J ), LDAB-1,
     $                           WORK31( JP+JJ-J-KL, 1 ), LDWORK )
                  END IF
               END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Copy the current column of A31 back into place
</span><span class="comment">*</span><span class="comment">
</span>               NW = MIN( I3, JJ-J+1 )
               IF( NW.GT.0 )
     $            CALL CCOPY( NW, WORK31( 1, JJ-J+1 ), 1,
     $                        AB( KV+KL+1-JJ+J, JJ ), 1 )
  170       CONTINUE
  180    CONTINUE
      END IF
<span class="comment">*</span><span class="comment">
</span>      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="CGBTRF.440"></a><a href="cgbtrf.f.html#CGBTRF.1">CGBTRF</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>
